import numpy as np
# 创建向量
arr1 = np.arange(1,5)
print(arr1) # [1 2 3 4]
# 升级为矩阵
arr1 = arr1.reshape(1,-1)
print(arr1) # [[1 2 3 4]]
# 行矩阵的转置
print(arr1.T)
"""
[[1]
 [2]
 [3]
 [4]]
"""

# 创建列矩阵
arr1 = np.arange(3).reshape(3,1)
print(arr1)
"""
[[0]
 [1]
 [2]]
"""
# 列矩阵的转置
arr2 = arr1.T
# 结果为行矩阵
print(arr2) # [[0 1 2]]

# 创建矩阵
arr1 = np.arange(1,10).reshape(3,3)
print(arr1)
"""
[[1 2 3]
 [4 5 6]
 [7 8 9]]
"""
# 矩阵的转置
arr2 = arr1.T
print(arr2)
"""
[[1 4 7]
 [2 5 8]
 [3 6 9]]
"""